<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>骡窝日报详情</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
		<script src="/js/jquery/jquery.min.js"></script>
		<script src="/js/bootstrap/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="/css/reset.css">
		<link rel="stylesheet" href="/css/newsContent.css">
		<script src="/js/plugins/jrender/jrender.min.js"></script>
		<script src="/js/common.js"></script>


	<script>
		$(function () {
            var params = getParams();

            $.get("/news/" + params.id + "/content",function (data) {
				console.log(data);
				$(".newsDetail").renderValues(data)//渲染

			})

		})


        $(function(){
            $("#praise").click(function(){
                var praise_img = $("#praise-img");
                var text_box = $("#add-num");
                var praise_txt = $("#praise-txt");
                var num=parseInt(praise_txt.text());
                if(praise_img.attr("src") == ("images/yizan.png")){
                    $(this).html("<img style='width: 20px' src='images/zan.png' id='praise-img' class='animation' />");
                    praise_txt.removeClass("hover");
                    text_box.show().html("<em class='add-animation'></em>");
                    $(".add-animation").removeClass("hover");
                    num -=1;
                    praise_txt.text(num)
                }else{
                    $(this).html("<img style='width: 20px' src='images/yizan.png' id='praise-img' class='animation' />");
                    praise_txt.addClass("hover");
                    text_box.show().html("<em class='add-animation'></em>");
                    $(".add-animation").addClass("hover");
                    num +=1;
                    praise_txt.text(num)
                }
            });
        })

        var userStr = sessionStorage.getItem("user");
        var user;
        if (userStr) {
            user = JSON.parse(userStr);
            $(".info").renderValues(user);
        }else{
            $("#collectBtn").addClass("fa-star-o");
        }





	</script>


	</head>

	<body>
		<div class="newsDetail">
			<div>
			<a href="javascript:history.go(-1);" style="position: absolute;top: 10px;left: 22px;">
				<span><i class="fa fa-chevron-left fa-2x" style="color: #3E3C3B;"></i></span>
			</a>
			<img render-src="coverUrl">

			<div class="container">
				<div class="row typeRow">
					<div class="col-4">
						<span class="type" render-html="type"></span>
					</div>
					<div class="col-2">
					</div>
					<div class="col-2">
						<span>By</span>
					</div>
					<div class="col-4">
						<span class="type">骡窝官方</span>
					</div>
				</div>

				<div class="detail">
					<h2 class="title" render-html="title"></h2>
					<div class="content" render-html="content"></div>

				</div>
			</div>
			</div>

			<div class="container d-flex">
				<!--点赞-->
				<div class="praise p-2 flex-fill"></i>
					<span id="praise"><img  src="images/zan.png" style='width: 20px' id="praise-img" /></span>
					<!--<span id="praise-txt"  render-html="content.niceCount"></span>-->
					<span id="add-num"><em></em></span>
				</div>

				<!--评论-->
				<div class="p-2  flex-fill"><i class="fa  fa-commenting-o" id="commentBtn"> </i>
					<a role="button">

					</a>
				</div>

				<!--收藏-->
				<div class="p-2  flex-fill"><i class="fa fa-star-o" id="collectBtn"> </i>
					<a>

					</a>
				</div>
			</div>

		</div>

</body>

</html>